import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);
// 登录验证
export default new Vuex.Store({
    state: {
        user: {},
        chatWebsocket: {},
        login: false,
        messageManager:null
    },
    mutations: {

        // 设置websocket信息
        setChatWebsocket(state, websocket) {
            state.chatWebsocket = websocket;
        },
        // 移除websocket信息
        removeChatWebsocket(state) {
            state.chatWebsocket = {};
        },
        setUser(state,user){
            state.user = user;
        },
        removeUser(state,user){
            state.user = {}
        },
        login(state,login){
            state.login = login;
        },
        logout(state,login){
            state.login = login;
        },
        setMessageManager(state,messages){
            state.messageManager = messages;
        },
        pushMessage(message){

        }
    }
})
